package com.ctsims.system.service.impl;

import java.util.List;

import com.ctsims.common.core.domain.entity.CtsDor;
import com.ctsims.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ctsims.system.mapper.CtsDorMapper;
import com.ctsims.system.service.ICtsDorService;

/**
 * 宿舍Service业务层处理
 *
 * @author hhz
 * @date 2023-03-29
 */
@Service
public class CtsDorServiceImpl implements ICtsDorService
{
    @Autowired
    private CtsDorMapper ctsDorMapper;

    /**
     * 查询宿舍
     *
     * @param dorId 宿舍主键
     * @return 宿舍
     */
    @Override
    public CtsDor selectCtsDorByDorId(Long dorId)
    {
        return ctsDorMapper.selectCtsDorByDorId(dorId);
    }

    /**
     * 查询宿舍列表
     *
     * @param ctsDor 宿舍
     * @return 宿舍
     */
    @Override
    public List<CtsDor> selectCtsDorList(CtsDor ctsDor)
    {
        return ctsDorMapper.selectCtsDorList(ctsDor);
    }

    /**
     * 新增宿舍
     *
     * @param ctsDor 宿舍
     * @return 结果
     */
    @Override
    public int insertCtsDor(CtsDor ctsDor)
    {
        ctsDor.setCreateTime(DateUtils.getNowDate());
        return ctsDorMapper.insertCtsDor(ctsDor);
    }

    /**
     * 修改宿舍
     *
     * @param ctsDor 宿舍
     * @return 结果
     */
    @Override
    public int updateCtsDor(CtsDor ctsDor)
    {
        ctsDor.setUpdateTime(DateUtils.getNowDate());
        return ctsDorMapper.updateCtsDor(ctsDor);
    }

    /**
     * 批量删除宿舍
     *
     * @param dorIds 需要删除的宿舍主键
     * @return 结果
     */
    @Override
    public int deleteCtsDorByDorIds(Long[] dorIds)
    {
        return ctsDorMapper.deleteCtsDorByDorIds(dorIds);
    }

    /**
     * 删除宿舍信息
     *
     * @param dorId 宿舍主键
     * @return 结果
     */
    @Override
    public int deleteCtsDorByDorId(Long dorId)
    {
        return ctsDorMapper.deleteCtsDorByDorId(dorId);
    }
}
